package org.dormi.learn;

import java.util.function.Predicate;

/**
 * @author : dormi330
 * @since : 21/11/15
 */
public class PredicateComposition {

    public static void main(String[] args) {
        main1();
    }

    public static void main1() {
        Predicate<String> startA = input -> input.startsWith("A");
        Predicate<String> endX = input -> input.endsWith("X");

        Predicate<String> startAEndX = input -> startA.test(input) && endX.test(input);
        Predicate<String> startAEndXV2 = startA.and(endX);

        String str = "A good relaX";
        System.out.println(startAEndX.test(str));
        System.out.println(startAEndXV2.test(str));
    }
}
